package com.xizimall.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
/**
 * 商品信息Controller
 * <p>Title: ItemController</p>
 * <p>Description: </p>
 * <p>华南理工大学研究生</p> 
 * @author	李隆熹
 * @date	2018年4月25日下午4:54:17
 * @version 1.0
 */
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xizimall.pojo.TbItem;
import com.xizimall.pojo.TbItemDesc;
import com.xizimall.portal.pojo.Item;
import com.xizimall.portal.pojo.ItemInfo;
import com.xizimall.portal.service.ItemService;
@Controller
public class ItemController {
    
	@Autowired
	private ItemService itemService;
	
	@RequestMapping("/item/{itemId}")
	public String showItem(@PathVariable Long itemId,Model model){
		ItemInfo item=itemService.getItemById(itemId);
		model.addAttribute("item", item);
		return "item";
	}
	@RequestMapping(value="/item/desc/{itemId}",produces=MediaType.TEXT_HTML_VALUE+";charset=utf-8")
	@ResponseBody
	public String showItemDesc(@PathVariable Long itemId){
		String result=itemService.getItemDesc(itemId);
		return result;
	}
	@RequestMapping(value="/item/param/{itemId}",produces=MediaType.TEXT_HTML_VALUE+";charset=utf-8")
	@ResponseBody
	public String showItemParam(@PathVariable Long itemId){
		String result=itemService.getItemParam(itemId);
		return result;
	}
}
